Python | Combine the values of two dictionaries having same key
Dictionary is a collection which is unordered, changeable and indexed. In Python, dictionaries are written with curly brackets, and they have keys and values. It is widely used in day to day programming, web development, and machine learning. Combining dictionaries is very common task in operations of dictionary. Let’s see how to combine the values of two dictionaries having same key....
read more
Maximum Balanced Subsequence Score
Given a stock’s prices for the past n days in the array stockPrice. Choose a subsequence (an ordered subset of an array’s elements) of stock prices, called chosenDays, such that the chosen subsequence of stock prices is balanced. The score of the chosen subsequence is the sum of stock prices on the chosen days. Find the maximum possible score that can be obtained by choosing an optimally balanced subsequence. The subsequence of stock prices is balanced if the following condition holds, stockPrice[chosenDays[i]]-stockPrice[chosenDays[i-1]] = chosenDays[i]-chosenDays[i – 1], for i > 0....
read more
Python – Split Dictionary values on size limit of values
Given a dictionary with string values, the task is to write a python program to split values if the size of string exceeds K....
read more
Python – Concatenate Ranged Values in String list
Given list of strings, perform concatenation of ranged values from the Strings list....
read more
Python – Remove Dictionary Key Words
Sometimes, while working with Python strings, we can have a problem in which we need to remove all the words from a string that is part of the key of the dictionary. This problem can have applications in domains such as web development and day-day programming. Let’s discuss certain ways in which this task can be performed....
read more
How to Compare Two Dictionaries in Python?
In this article, we will discuss how to compare two dictionaries in Python. As we all know what is a dictionary, but sometimes we may need to compare two dictionaries. Let’s see different methods to do the same....
read more
Python Program to convert Dictionary to List by Repeating keys corresponding value times
Given a dictionary where keys are characters and their constituent values are numbers, the task here is to write a python program that can convert it to a list by repeating the key character value times....
read more
Python – All possible items combination dictionary
Sometimes, while working with data, we can have a problem in which we are provided with sample data of key and value list and we require to construct actual data as all possible combination of keys and value list of similar size. Lets discuss certain ways in which this task can be performed....
read more
Python – Maximum of filtered Keys in dictionary
Sometimes while working with Python dictionaries, we might have a problem in which we require to just maximum the selective key values from the dictionary. This problem can occur in web development domain. Let’s discuss certain ways in which this problem can be solved....
read more
Python | Minimum number of subsets with distinct elements using Counter
You are given an array of n-element. You have to make subsets from the array such that no subset contain duplicate elements. Find out minimum number of subset possible. Examples:...
read more
Count of groups having largest size while grouping according to sum of its digits
Given an integer N, the task is to find the number of groups having the largest size. Each number from 1 to N is grouped according to the sum of its digits....
read more
Python | Select dictionary with condition given key greater than k
In Python, sometimes we require to get only some of the dictionary required to solve the problem. This problem is quite common in web development that we require to get only the selective dictionary satisfying some given criteria. Let’s discuss certain ways in which this problem can be solved....
read more